/**
 *
 * @time    2019-08-29 12:57
 * @title   http请求封装
 * @desc
 *
 */
 import {Interceptors} from './interceptors';
 import { AxiosPromise, AxiosResponse } from 'axios';

 export class HttpService {
    axios: any;
 
     constructor() {
             // 获取axios实例
         this.axios = new Interceptors().getInterceptors();
     }
 
     // 简单封装一下方法
    request(config: any): AxiosPromise {
        return new Promise((resolve, reject) => {
            this.axios(config).then((res: AxiosResponse) => {
                resolve(res);
            }).catch((err: any) => {
                reject(err)
            });
        });
    }
    
 }

 const http = new HttpService()
 export default http